<template>
	<view class="piaofu">
	  <view @click="backTop" v-if="backTopValue"><image src='../../static/images/bakctop.png' mode="scaleToFill" class="backtop"></image></view>
	  <view @click='backhome'><image src='../../static/images/backhome.png' mode="scaleToFill" class="backhome" ></image></view>
	</view>
</template>

<script>
	export default {
		name:"BackHome",
		data() {
			return {
				backTopValue: false,
			};
		},
		props: {
			backTopIsShow: {
				type: Boolean,
				default() {
					return false;
				}
			}
		},
		methods:{
		  // 滚动到顶部
		  backTop() {
			// 控制滚动
			uni.pageScrollTo({
			    duration:0,
			    scrollTop:0,
			})
		  },
		  backhome() {
			  uni.switchTab({
				  url: '../../pages/index/index'
			  })
		  },
		},
		watch: {
			backTopIsShow: function(newVal, oldVal) {
				this.backTopValue = newVal;
				console.log(this.backTopValue)
			}
		}
	}
</script>

<style scoped>
.piaofu {
  position: fixed;
  right: 20rpx;
  bottom: 80rpx;
  text-align: center;
  flex-direction:row;
}
.backhome{
  width: 94rpx;
  height: 94rpx;
}
.backtop{
  width: 94rpx;
  height: 94rpx;
  margin-bottom: 15rpx;

}
</style>
